<?php
	
	/**
	 * return devmod not as array of items [0] = array(), [1] = array() it will return only the zero element,
	 * if there is really only just 1 element return $args[0]
	 * 
	 * 17/01/2011 - class creation
	 * 
	 * @author bsuter
	 * @package devmod
	 */
	class Devmod_method_singleReturn extends Devmod_methods_abstraction {

		protected $after_operation = array(array(
										'for_method' => 'export',
										'for_method_type' => 'frontend_list',
										'use' => 'return_as_single'
									));
		
		/**
		 * #function params are observed by func_get_args#
		 */
		public function set_config($args)
		{
			$this->update_config('single_return', true);
		}

		
		public function return_as_single($args)
		{
			if(!isset($this->config[$this->type]['single_return'])) return $args;
			
			if(count($args) !== 1)
			{
				new Yomm_Error("DevMod casted as singleReturn but count is: " . count($args));
				return $args;
			}
			
			return $args[0];
		}
	}
